// 创建闭包
let Singleton = (function() {
    let instance; // undefined 
    return function(name) {
      // 返回实例
      if (instance) {
        return instance;
      }
      this.name = name;
      return instance = this;
    }
  })();
  
  Singleton.prototype.getName = function() {
    console.log(this.name);
  }
  
  let Winner = new Singleton('Winner');
  let Looser = new Singleton('Looser');
  console.log(Singleton.prototype);
  console.log(Winner == Looser); 
  Winner.getName();
  